import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state = {
  menuValue: 'defaultPage'
}
const getters = {
  getMenu: function () {
    console.log('get:' + state.menuValue)
    // state.menuValue = 'goodsAdd'
    return state.menuValue
  }
}
const mutations = {
  menuCurrentView: function (state, params) {
    state.menuValue = params.page
    console.log('mutations:' + state.menuView)
  }
}
const actions = {
  changeMenuView: function (context, params) {
    context.commit('menuCurrentView', params)
    console.log('actions:' + params.page)
  }
}
export default new Vuex.Store({
  state,
  mutations,
  actions,
  getters
})
